<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>隐藏元素的几种方式</title>
    <style>
      .v {
        visibility: hidden;
      }
      .o {
        opacity: 0;
        color: red;
      }

      .triangle {
        width: 0;
        height: 0;
        border-top: 50px solid transparent;
        border-bottom: 50px solid transparent;
        /* border-right: 50px solid transparent; */
        border-left: 50px solid red;
      }
    </style>
  </head>
  <body>
    <h2>隐藏元素visibility和opacity的区别</h2>
    <p class="v">visibility</p>
    <p class="o">opacity</p>

    <div class="triangle"></div>

    <script>
      const v = document.querySelector(".v");
      const o = document.querySelector(".o");

      v.onclick = function (e) {
        console.log({ e });
      };

      o.onclick = function (e) {
        console.log(e);
      };
    </script>
  </body>
</html>
